from django.db import models


# Create your models here.
class Stock(models.Model):
    """
    进货表
    """
    id = models.AutoField(primary_key=True)
    factory = models.CharField(max_length=50, verbose_name='制药厂家')
    specification = models.CharField(max_length=50, verbose_name='药品规格')
    name = models.CharField(max_length=50, verbose_name='药品名称')
    serial_number = models.CharField(max_length=30,verbose_name='流水号')
    num = models.IntegerField(verbose_name='进货数量')
    money = models.DecimalField(verbose_name='进货单价',decimal_places=2,max_digits=8)
    date = models.DateField(verbose_name='进货时间', auto_now=True)
    money_all = models.CharField(max_length=50, verbose_name='进货总价')
    la_num = models.IntegerField(verbose_name='库存信息')

    class Meta:
        db_table = 'Stock'


class Shipment(models.Model):
    """
    销售表，带库存
    """
    id = models.AutoField(primary_key=True)
    factory = models.CharField(max_length=50, verbose_name='制药厂家')
    specification = models.CharField(max_length=50, verbose_name='药品规格')
    name = models.CharField(max_length=50, verbose_name='药品名称')
    serial_number = models.CharField(max_length=30, verbose_name='流水号')
    num = models.IntegerField(verbose_name='销售数量')
    # 允许小数点
    money = models.CharField(max_length=50, verbose_name='单价')
    date = models.DateField(verbose_name='销售时间', auto_now=True)
    money_all = models.CharField(max_length=50, verbose_name='单次销售利润')

    class Meta:
        db_table = 'Shipment'


class Profit(models.Model):
    """
    每日利润表
    """
    id = models.AutoField(primary_key=True)
    factory = models.CharField(max_length=50, verbose_name='制药厂家')
    specification = models.CharField(max_length=50, verbose_name='药品规格')
    name = models.CharField(max_length=50, verbose_name='药品名称')
    date = models.DateField(verbose_name='时间', auto_now=True)
    money_all = models.CharField(max_length=50, verbose_name='利润额')

    class Meta:
        db_table = 'Profit'
